Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PC-34454)[API] feat: add publicationDate to Algolia serializer #16241

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

bpeyrou-pass
Copy link
Contributor

@bpeyrou-pass bpeyrou-pass commented Feb 7, 2025

But de la pull request

Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-34454

Vérifications

  • J'ai écrit les tests nécessaires
  • J'ai mis à jour le fichier des plans de tests du portail pro si nécessaire
  • J'ai mis à jour la liste des routes et des titres de pages du portail pro si j'en ai rajouté/modifié ou supprimé une.
  • J'ai relu attentivement les migrations, en particulier pour éviter les locks, et je préviens les équipes Shérif et Data
  • J'ai ajouté des screenshots pour d'éventuels changements graphiques
  • J'ai fait la revue fonctionnelle de mon ticket

@@ -573,6 +573,9 @@ def serialize_offer(cls, offer: offers_models.Offer, last_30_days_bookings: int)
"name": offer.name,
"nativeCategoryId": offer.subcategory.native_category_id,
"prices": sorted(prices),
"publicationDate": (
offer.publicationDate.isoformat() if offer.publicationDate and not offer.isReleased else None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jusqu'ici on envoie (quasiment il me semble) toutes les dates au front sous forme de timestamp (les champs dates, times, isHeadlineUntil, releaseDate), on est ok sur le fait de gérer un nouveau format ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas de soucis pour changer, j'avais pris le même format que la date d'indexation mais je vais passer ça en timestamp :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, c'est vrai que c'est la seule incohérence, bien vu. C'est pas expliqué mais indexedAt a été introduit uniquement pour du debug, d'où un format lisible par les humains, my bad.

offers_factories.FutureOfferFactory(offerId=offer_2.id, publicationDate=publication_date)

serialized = algolia.AlgoliaBackend().serialize_offer(offer_1, 0)
assert serialized["offer"]["publicationDate"] == publication_date.isoformat()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(vraiment détail) Par rapport à l'autre comm, je trouve ça cool ici si on écrit en dur la date qu'on attend pour que le format soit explicite

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il me faut tout de même une date dans le futur, que je ne connais pas à priori hormis si je gèle le temps. Je me dis que c'est un peu overkill non ?

@bpeyrou-pass bpeyrou-pass merged commit 465ef7b into master Feb 10, 2025
25 checks passed
@bpeyrou-pass bpeyrou-pass deleted the PC-34454 branch February 10, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants